/*
 * $RCSfile: StringConverter.java,v $
 * $Revision: 32.4 $
 *
 * Comments:
 *
 * (C) Copyright Biuro-Technika 1996.  All rights reserved.
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Biuro-Technika
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 *
 * $Author: michal $          $Locker:  $
 * $Date: 2009/09/22 12:09:10 $
 * $Log: StringConverter.java,v $
 * Revision 32.4  2009/09/22 12:09:10  michal
 * ParaSoft -> Biuro-Technika
 *
 * Revision 32.3  2005/09/16 11:04:28  muzzy
 * utf
 *
 * Revision 32.2  2005/09/15 12:13:49  muzzy
 * mazovia
 *
 * Revision 32.1  2001/10/29 12:38:59  limbur
 * Original source code.
 *
 */

package parasoft.centrap.utils;

public class StringConverter
{
    private StringConverter() { }

    public static String latinToISO(String source)
    {
        if(source == null) {
            return null;
        }

        String buffer = new String(source);

        buffer = buffer.replace('\u00A4', '\u00A1');
        buffer = buffer.replace('\u008F', '\u00C6');
        buffer = buffer.replace('\u00A8', '\u00CA');
        buffer = buffer.replace('\u009D', '\u00A3');
        buffer = buffer.replace('\u00E3', '\u00D1');
        buffer = buffer.replace('\u00E0', '\u00D3');
        buffer = buffer.replace('\u0097', '\u00A6');
        buffer = buffer.replace('\u008D', '\u00AC');
        buffer = buffer.replace('\u00BD', '\u00AF');

        buffer = buffer.replace('\u00a5', '\u00b1');
        buffer = buffer.replace('\u0086', '\u00e6');
        buffer = buffer.replace('\u00a9', '\u00ea');
        buffer = buffer.replace('\u0088', '\u00b3');
        buffer = buffer.replace('\u00e4', '\u00f1');
        buffer = buffer.replace('\u00a2', '\u00f3');
        buffer = buffer.replace('\u0098', '\u00b6');
        buffer = buffer.replace('\u00ab', '\u00bc');
        buffer = buffer.replace('\u00be', '\u00bf');

        return buffer;
    }
    public static String isoToLatin(String source)
    {
        if(source == null) {
            return null;
        }

        String buffer = new String(source);

        buffer = buffer.replace('\u00A1', '\u00A4');
        buffer = buffer.replace('\u00C6', '\u008F');
        buffer = buffer.replace('\u00CA', '\u00A8');
        buffer = buffer.replace('\u00A3', '\u009D');
        buffer = buffer.replace('\u00D1', '\u00E3');
        buffer = buffer.replace('\u00D3', '\u00E0');
        buffer = buffer.replace('\u00A6', '\u0097');
        buffer = buffer.replace('\u00AC', '\u008D');
        buffer = buffer.replace('\u00AF', '\u00BD');

        buffer = buffer.replace('\u00b1', '\u00a5');
        buffer = buffer.replace('\u00e6', '\u0086');
        buffer = buffer.replace('\u00ea', '\u00a9');
        buffer = buffer.replace('\u00b3', '\u0088');
        buffer = buffer.replace('\u00f1', '\u00e4');
        buffer = buffer.replace('\u00f3', '\u00a2');
        buffer = buffer.replace('\u00b6', '\u0098');
        buffer = buffer.replace('\u00bc', '\u00ab');
        buffer = buffer.replace('\u00bf', '\u00be');

        return buffer;
    }

    public static String utfToMazovia(String source)
    {
        if(source == null) {
            return null;
        }

        String buffer = new String(source);

        buffer = buffer.replace('\u0104', '\u008F');
        buffer = buffer.replace('\u0106', '\u0095');
        buffer = buffer.replace('\u0118', '\u0090');
        buffer = buffer.replace('\u0141', '\u009C');
        buffer = buffer.replace('\u0143', '\u00A5');
        buffer = buffer.replace('\u00D3', '\u00A3');
        buffer = buffer.replace('\u015A', '\u0098');
        buffer = buffer.replace('\u0179', '\u00A0');
        buffer = buffer.replace('\u017B', '\u00A1');

        buffer = buffer.replace('\u0105', '\u0086');
        buffer = buffer.replace('\u0107', '\u008d');
        buffer = buffer.replace('\u0119', '\u0091');
        buffer = buffer.replace('\u0142', '\u0092');
        buffer = buffer.replace('\u0144', '\u00a4');
        buffer = buffer.replace('\u00f3', '\u00a2');
        buffer = buffer.replace('\u015b', '\u009e');
        buffer = buffer.replace('\u017a', '\u00a6');
        buffer = buffer.replace('\u017c', '\u00a7');

        return buffer;
    }
}
